home *** CD-ROM | disk | FTP | other *** search
- Path: news.larc.nasa.gov!amiga-request
- From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
- Subject: v91i143: SimpleRexx - ARexx support made simple, Part01/01
- Reply-To: mks@cbmvax.uucp (Michael Sinz)
- Newsgroups: comp.sources.amiga
- Message-ID: <comp.sources.amiga.v91i143@ab20.larc.nasa.gov>
- Date: 30 Jul 91 00:48:25 GMT
- Approved: tadguy@uunet.UU.NET (Tad Guy)
- X-Mail-Submissions-To: amiga@uunet.uu.net
- X-Post-Discussions-To: comp.sys.amiga.misc
-
- Submitted-by: mks@cbmvax.uucp (Michael Sinz)
- Posting-number: Volume 91, Issue 143
- Archive-name: rexx/simplerexx/part01
-
- [ includes uuencoded executable ...tad ]
-
- ARexx, ARexx, ARexx. 2.0 has ARexx. So, why and how do I
- support ARexx?
-
- The "Why?" has been answered elsewhere and that is not what this
- article is about. Let it suffice that you should support ARexx
- within your application. It is a standard that Commodore is
- pushing and we hope that all new applications will have ARexx
- support.
-
- As to the "How?", that is what this article is about. We
- understand that your existing software may not currently support
- ARexx and that some of you may never even have looked at what is
- needed to support ARexx. New applications can be designed with
- ARexx support in mind and, with the advent of the AppShell by
- David Junod, the work involved to support ARexx is nothing more
- than what is needed to support the features within you
- application. However, existing code may not move into the
- AppShell to easily and you may wish to do a minor upgrade to
- your application to support ARexx.
-
- SimpleRexx is a set of routines that handle the low-level ARexx
- work for you in such a way as to have your application work with
- or without ARexx on the target system. The goal of SimpleRexx is
- to make adding at least the minimum level of ARexx support to an
- application a trivial task.
-
- #!/bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 1)."
- # Contents: MakeFile SimpleRexx.c SimpleRexx.doc SimpleRexx.h
- # SimpleRexxE.uu SimpleRexxExample.c test.results test.rexx
- # Wrapped by tadguy@ab20 on Mon Jul 29 20:48:24 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'MakeFile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MakeFile'\"
- else
- echo shar: Extracting \"'MakeFile'\" \(464 characters\)
- sed "s/^X//" >'MakeFile' <<'END_OF_FILE'
- X#
- X# MakeFile for SimpleRexx and SimpleRexxExample
- X#
- X
- XCFLAGS= -b1 -cfist -d0 -ms0 -rr1 -v -w
- X
- XHEAD= SimpleRexx.h
- X
- XCODE= SimpleRexx.c SimpleRexxExample.c
- X
- XOBJS= SimpleRexx.o SimpleRexxExample.o
- X
- XLIBS= LIB:lcsr.lib rexxvars.o LIB:amiga.lib
- X
- X.c.o:
- X @LC $(CFLAGS) $*
- X
- XSimpleRexxExample: $(OBJS) $(LIBS)
- X BLink FROM LIB:c.o $(OBJS) TO SimpleRexxExample LIB $(LIBS) SD SC ND
- X
- XSimpleRexx.o: SimpleRexx.c SimpleRexx.h
- X
- XSimpleRexxExample.o: SimpleRexxExample.c SimpleRexx.h
- END_OF_FILE
- if test 464 -ne `wc -c <'MakeFile'`; then
- echo shar: \"'MakeFile'\" unpacked with wrong size!
- fi
- # end of 'MakeFile'
- fi
- if test -f 'SimpleRexx.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'SimpleRexx.c'\"
- else
- echo shar: Extracting \"'SimpleRexx.c'\" \(10230 characters\)
- sed "s/^X//" >'SimpleRexx.c' <<'END_OF_FILE'
- X/*
- X * Simple ARexx interface by Michael Sinz
- X *
- X * This is a very "Simple" interface to the world of ARexx...
- X * For more complex interfaces into ARexx, it is best that you
- X * understand the functions that are provided by ARexx.
- X * In many cases they are more powerful than what is presented
- X * here.
- X *
- X * This code is fully re-entrant and self-contained other than
- X * the use of SysBase/AbsExecBase and the ARexx RVI support
- X * library which is also self-contained...
- X */
- X
- X#include <exec/types.h>
- X#include <exec/nodes.h>
- X#include <exec/lists.h>
- X#include <exec/ports.h>
- X#include <exec/memory.h>
- X
- X#include <proto/exec.h>
- X
- X#include <rexx/storage.h>
- X#include <rexx/rxslib.h>
- X
- X#include <string.h>
- X#include <ctype.h>
- X
- X/*
- X * The prototypes for the few ARexx functions we will call...
- X */
- Xstruct RexxMsg *CreateRexxMsg(struct MsgPort *,char *,char *);
- Xvoid *CreateArgstring(char *,long);
- Xvoid DeleteRexxMsg(struct RexxMsg *);
- Xvoid DeleteArgstring(char *);
- XBOOL IsRexxMsg(struct Message *);
- X
- X/*
- X * Pragmas for the above functions... (To make this all self-contained...)
- X * If you use RexxGlue.o, this is not needed...
- X *
- X * These are for Lattice C 5.x (Note the use of RexxContext->RexxSysBase)
- X */
- X#pragma libcall RexxContext->RexxSysBase CreateRexxMsg 90 09803
- X#pragma libcall RexxContext->RexxSysBase CreateArgstring 7E 0802
- X#pragma libcall RexxContext->RexxSysBase DeleteRexxMsg 96 801
- X#pragma libcall RexxContext->RexxSysBase DeleteArgstring 84 801
- X#pragma libcall RexxContext->RexxSysBase IsRexxMsg A8 801
- X
- X/*
- X * Prototypes for the RVI ARexx calls... (link with RexxVars.o)
- X */
- X__stdargs long CheckRexxMsg(struct RexxMsg *);
- X__stdargs long GetRexxVar(struct RexxMsg *,char *,char **);
- X__stdargs long SetRexxVar(struct RexxMsg *,char *,char *,long);
- X
- X/*
- X * Now, we have made the pragmas needed, let's get to work...
- X */
- X
- X/*
- X * A structure for the ARexx handler context
- X * This is *VERY* *PRIVATE* and should not be touched...
- X */
- Xstruct ARexxContext
- X{
- Xstruct MsgPort *ARexxPort; /* The port messages come in at... */
- Xstruct Library *RexxSysBase; /* We will hide the library pointer here... */
- X long Outstanding; /* The count of outstanding ARexx messages... */
- X char PortName[24]; /* The port name goes here... */
- X char ErrorName[28]; /* The name of the <base>.LASTERROR... */
- X char Extension[8]; /* Default file name extension... */
- X};
- X
- X#define AREXXCONTEXT struct ARexxContext *
- X
- X#include "SimpleRexx.h"
- X
- X/*
- X * This function returns the port name of your ARexx port.
- X * It will return NULL if there is no ARexx port...
- X *
- X * This string is *READ ONLY* You *MUST NOT* modify it...
- X */
- Xchar *ARexxName(AREXXCONTEXT RexxContext)
- X{
- Xregister char *tmp=NULL;
- X
- X if (RexxContext) tmp=RexxContext->PortName;
- X return(tmp);
- X}
- X
- X/*
- X * This function returns the signal mask that the Rexx port is
- X * using. It returns NULL if there is no signal...
- X *
- X * Use this signal bit in your Wait() loop...
- X */
- XULONG ARexxSignal(AREXXCONTEXT RexxContext)
- X{
- Xregister ULONG tmp=NULL;
- X
- X if (RexxContext) tmp=1L << (RexxContext->ARexxPort->mp_SigBit);
- X return(tmp);
- X}
- X
- X/*
- X * This function returns a structure that contains the commands sent from
- X * ARexx... You will need to parse it and return the structure back
- X * so that the memory can be freed...
- X *
- X * This returns NULL if there was no message...
- X */
- Xstruct RexxMsg *GetARexxMsg(AREXXCONTEXT RexxContext)
- X{
- Xregister struct RexxMsg *tmp=NULL;
- Xregister short flag;
- X
- X if (RexxContext)
- X if (tmp=(struct RexxMsg *)GetMsg(RexxContext->ARexxPort))
- X {
- X if (tmp->rm_Node.mn_Node.ln_Type==NT_REPLYMSG)
- X {
- X /*
- X * If we had sent a command, it would come this way...
- X *
- X * Since we don't in this simple example, we just throw
- X * away anything that looks "strange"
- X */
- X flag=FALSE;
- X if (tmp->rm_Result1) flag=TRUE;
- X
- X /*
- X * Free the arguments and the message...
- X */
- X DeleteArgstring(tmp->rm_Args[0]);
- X DeleteRexxMsg(tmp);
- X RexxContext->Outstanding-=1;
- X
- X /*
- X * Return the error if there was one...
- X */
- X tmp=flag ? REXX_RETURN_ERROR : NULL;
- X }
- X }
- X return(tmp);
- X}
- X
- X/*
- X * Use this to return a ARexx message...
- X *
- X * If you wish to return something, it must be in the RString.
- X * If you wish to return an Error, it must be in the Error.
- X * If there is an error, the RString is ignored.
- X */
- Xvoid ReplyARexxMsg(AREXXCONTEXT RexxContext,struct RexxMsg *rmsg,
- X char *RString,LONG Error)
- X{
- X if (RexxContext) if (rmsg) if (rmsg!=REXX_RETURN_ERROR)
- X {
- X rmsg->rm_Result2=0;
- X if (!(rmsg->rm_Result1=Error))
- X {
- X /*
- X * if you did not have an error we return the string
- X */
- X if (rmsg->rm_Action & (1L << RXFB_RESULT)) if (RString)
- X {
- X rmsg->rm_Result2=(LONG)CreateArgstring(RString,
- X (LONG)strlen(RString));
- X }
- X }
- X
- X /*
- X * Reply the message to ARexx...
- X */
- X ReplyMsg((struct Message *)rmsg);
- X }
- X}
- X
- X/*
- X * This function will set an error string for the ARexx
- X * application in the variable defined as <appname>.LASTERROR
- X *
- X * Note that this can only happen if there is an ARexx message...
- X *
- X * This returns TRUE if it worked, FALSE if it did not...
- X */
- Xshort SetARexxLastError(AREXXCONTEXT RexxContext,struct RexxMsg *rmsg,
- X char *ErrorString)
- X{
- Xregister short OkFlag=FALSE;
- X
- X if (RexxContext) if (rmsg) if (CheckRexxMsg(rmsg))
- X {
- X /*
- X * Note that SetRexxVar() has more than just a TRUE/FALSE
- X * return code, but for this "basic" case, we just care if
- X * it works or not.
- X */
- X if (!SetRexxVar(rmsg,RexxContext->ErrorName,ErrorString,
- X (long)strlen(ErrorString)))
- X {
- X OkFlag=TRUE;
- X }
- X }
- X return(OkFlag);
- X}
- X
- X/*
- X * This function will send a string to ARexx...
- X *
- X * The default host port will be that of your task...
- X *
- X * If you set StringFile to TRUE, it will set that bit for the message...
- X *
- X * Returns TRUE if it send the message, FALSE if it did not...
- X */
- Xshort SendARexxMsg(AREXXCONTEXT RexxContext,char *RString,
- X short StringFile)
- X{
- Xregister struct MsgPort *RexxPort;
- Xregister struct RexxMsg *rmsg;
- Xregister short flag=FALSE;
- X
- X if (RexxContext) if (RString)
- X {
- X if (rmsg=CreateRexxMsg(RexxContext->ARexxPort,
- X RexxContext->Extension,
- X RexxContext->PortName))
- X {
- X rmsg->rm_Action=RXCOMM | (StringFile ?
- X (1L << RXFB_STRING):0);
- X if (rmsg->rm_Args[0]=CreateArgstring(RString,
- X (LONG)strlen(RString)))
- X {
- X /*
- X * We need to find the RexxPort and this needs
- X * to be done in a Forbid()
- X */
- X Forbid();
- X if (RexxPort=FindPort(RXSDIR))
- X {
- X /*
- X * We found the port, so put the
- X * message to ARexx...
- X */
- X PutMsg(RexxPort,(struct Message *)rmsg);
- X RexxContext->Outstanding+=1;
- X flag=TRUE;
- X }
- X else
- X {
- X /*
- X * No port, so clean up...
- X */
- X DeleteArgstring(rmsg->rm_Args[0]);
- X DeleteRexxMsg(rmsg);
- X }
- X Permit();
- X }
- X else DeleteRexxMsg(rmsg);
- X }
- X }
- X return(flag);
- X}
- X
- X/*
- X * This function closes down the ARexx context that was opened
- X * with InitARexx...
- X */
- Xvoid FreeARexx(AREXXCONTEXT RexxContext)
- X{
- Xregister struct RexxMsg *rmsg;
- X
- X if (RexxContext)
- X {
- X /*
- X * Clear port name so it can't be found...
- X */
- X RexxContext->PortName[0]='\0';
- X
- X /*
- X * Clean out any outstanding messages we had sent out...
- X */
- X while (RexxContext->Outstanding)
- X {
- X WaitPort(RexxContext->ARexxPort);
- X while (rmsg=GetARexxMsg(RexxContext))
- X {
- X if (rmsg!=REXX_RETURN_ERROR)
- X {
- X /*
- X * Any messages that come now are blown
- X * away...
- X */
- X SetARexxLastError(RexxContext,rmsg,
- X "99: Port Closed!");
- X ReplyARexxMsg(RexxContext,rmsg,
- X NULL,100);
- X }
- X }
- X }
- X
- X /*
- X * Clean up the port and delete it...
- X */
- X if (RexxContext->ARexxPort)
- X {
- X while (rmsg=GetARexxMsg(RexxContext))
- X {
- X /*
- X * Any messages that still are coming in are
- X * "dead" We just set the LASTERROR and
- X * reply an error of 100...
- X */
- X SetARexxLastError(RexxContext,rmsg,
- X "99: Port Closed!");
- X ReplyARexxMsg(RexxContext,rmsg,NULL,100);
- X }
- X DeletePort(RexxContext->ARexxPort);
- X }
- X
- X /*
- X * Make sure we close the library...
- X */
- X if (RexxContext->RexxSysBase)
- X {
- X CloseLibrary(RexxContext->RexxSysBase);
- X }
- X
- X /*
- X * Free the memory of the RexxContext
- X */
- X FreeMem(RexxContext,sizeof(struct ARexxContext));
- X }
- X}
- X
- X/*
- X * This routine initializes an ARexx port for your process
- X * This should only be done once per process. You must call it
- X * with a valid application name and you must use the handle it
- X * returns in all other calls...
- X *
- X * NOTE: The AppName should not have spaces in it...
- X * Example AppNames: "MyWord" or "FastCalc" etc...
- X * The name *MUST* be less that 16 characters...
- X * If it is not, it will be trimmed...
- X * The name will also be UPPER-CASED...
- X *
- X * NOTE: The Default file name extension, if NULL will be
- X * "rexx" (the "." is automatic)
- X */
- XAREXXCONTEXT InitARexx(char *AppName,char *Extension)
- X{
- Xregister AREXXCONTEXT RexxContext=NULL;
- Xregister short loop;
- Xregister short count;
- Xregister char *tmp;
- X
- X if (RexxContext=AllocMem(sizeof(struct ARexxContext),
- X MEMF_PUBLIC|MEMF_CLEAR))
- X {
- X if (RexxContext->RexxSysBase=OpenLibrary("rexxsyslib.library",
- X NULL))
- X {
- X /*
- X * Set up the extension...
- X */
- X if (!Extension) Extension="rexx";
- X tmp=RexxContext->Extension;
- X for (loop=0;(loop<7)&&(Extension[loop]);loop++)
- X {
- X *tmp++=Extension[loop];
- X }
- X *tmp='\0';
- X
- X /*
- X * Set up a port name...
- X */
- X tmp=RexxContext->PortName;
- X for (loop=0;(loop<16)&&(AppName[loop]);loop++)
- X {
- X *tmp++=toupper(AppName[loop]);
- X }
- X *tmp='\0';
- X
- X /*
- X * Set up the last error RVI name...
- X *
- X * This is <appname>.LASTERROR
- X */
- X strcpy(RexxContext->ErrorName,RexxContext->PortName);
- X strcat(RexxContext->ErrorName,".LASTERROR");
- X
- X /* We need to make a unique port name... */
- X Forbid();
- X for (count=1,RexxContext->ARexxPort=(VOID *)1;
- X RexxContext->ARexxPort;count++)
- X {
- X stci_d(tmp,count);
- X RexxContext->ARexxPort=
- X FindPort(RexxContext->PortName);
- X }
- X
- X RexxContext->ARexxPort=CreatePort(
- X RexxContext->PortName,NULL);
- X Permit();
- X }
- X
- X if ( (!(RexxContext->RexxSysBase))
- X || (!(RexxContext->ARexxPort)) )
- X {
- X FreeARexx(RexxContext);
- X RexxContext=NULL;
- X }
- X }
- X return(RexxContext);
- X}
- END_OF_FILE
- if test 10230 -ne `wc -c <'SimpleRexx.c'`; then
- echo shar: \"'SimpleRexx.c'\" unpacked with wrong size!
- fi
- # end of 'SimpleRexx.c'
- fi
- if test -f 'SimpleRexx.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'SimpleRexx.doc'\"
- else
- echo shar: Extracting \"'SimpleRexx.doc'\" \(7339 characters\)
- sed "s/^X//" >'SimpleRexx.doc' <<'END_OF_FILE'
- X SimpleRexx
- X by
- X Michael Sinz
- X
- X A Simplified Interface into the world of ARexx
- X
- X
- X ARexx, ARexx, ARexx. 2.0 has ARexx. So, why and how do I
- X support ARexx?
- X
- X The "Why?" has been answered elsewhere and that is not what this
- X article is about. Let it suffice that you should support ARexx
- X within your application. It is a standard that Commodore is
- X pushing and we hope that all new applications will have ARexx
- X support.
- X
- X As to the "How?", that is what this article is about. We
- X understand that your existing software may not currently support
- X ARexx and that some of you may never even have looked at what is
- X needed to support ARexx. New applications can be designed with
- X ARexx support in mind and, with the advent of the AppShell by
- X David Junod, the work involved to support ARexx is nothing more
- X than what is needed to support the features within you
- X application. However, existing code may not move into the
- X AppShell to easily and you may wish to do a minor upgrade to
- X your application to support ARexx.
- X
- X SimpleRexx is a set of routines that handle the low-level ARexx
- X work for you in such a way as to have your application work with
- X or without ARexx on the target system. The goal of SimpleRexx is
- X to make adding at least the minimum level of ARexx support to an
- X application a trivial task.
- X
- X
- X Working with ARexx
- X
- X REXX is, at its heart, a string processing language. Most
- X everything that happens in REXX is in the form of a string; even
- X numbers are passed as ASCII representations in most situations.
- X
- X The Amiga implementation of REXX, known as ARexx, and is part of
- X Release 2.0 of AmigaDOS. ARexx has a very complete
- X implementation of the REXX language plus the ability to send and
- X receive control messages from "outside" sources. ARexx the can
- X operate on them in synchronous fashion. The messages contain
- X text strings that are then interpreted by ARexx as REXX commands
- X or by the "outside" source (the Application) as its commands.
- X
- X An application that "supports ARexx" is one that can receive and
- X send ARexx messages. The messages are, like the REXX language,
- X string based and contain the command string of the operation
- X wanted.
- X
- X To make this even more interesting, there are ways to send and
- X receive data from ARexx. The data can come in the message itself
- X or via the ARexx RVI (Rexx Variable Interface). In either case
- X data can be transferred to and from ARexx. A complete ARexx
- X supporting application would need to be able to send data to a
- X requesting ARexx program/script and get data from that program.
- X
- X The following code shows how to use the ARexx support library to
- X send and receive ARexx messages. It also is a "wrapper" around
- X these functions to provide a simplified interface to ARexx to
- X help promote and simplify the idea of adding ARexx support to
- X your existing applications.
- X
- X SimpleRexxExample.c is a very simple example of the use of the
- X calls in SimpleRexx. The test.rexx script is an example script
- X to try running while SimpleRexxExample is running. It will send
- X commands to SimpleRexxExample in order to control it.
- X test.results is the output of test.rexx.
- X
- X
- X Overview of Functions
- X
- X The source to SimpleRexx is a single file. It is SimpleRexx.c.
- X The header file to that contains the type definitions and
- X prototypes for the functions is in the file SimpleRexx.h.
- X
- X Functions that are "available" via SimpleRexx are used as
- X follows:
- X
- X
- X rexx_handle=InitARexx(AppBaseName,Extension)
- X
- X This initializes a SimpleRexx context. The rexx_handle
- X is much like a file handle in that it will be used in
- X all other calls that make use of this SimpleRexx
- X context. Since all SimpleRexx calls correctly check
- X the rexx_handle before doing work, you do not need to
- X check the return result of this call. If ARexx is not
- X available on your system, SimpleRexx will just not do
- X anything.
- X
- X
- X port_name=ARexxName(rexx_handle)
- X
- X This function returns a pointer to the name of the
- X ARexx port for your context. The name is based on the
- X AppBaseName plus an invocation number such that
- X multiple copies of an application can run at the same
- X time. If you have no ARexx port, it returns NULL.
- X
- X
- X sigmask=ARexxSignal(rexx_handle)
- X
- X This function returns the signal bit mask that is
- X needed for the port that is part of your context. This
- X should be combined with other signal masks to produce
- X the argument to the Wait() call. This returns NULL if
- X there is no signal mask.
- X
- X
- X rmsg=GetARexxMsg(rexx_handle)
- X
- X This function returns the next Rexx message that is
- X waiting. rmsg==NULL if there is no message or ARexx is
- X not around. rmsg==REXX_RETURN_ERROR if a message sent
- X to ARexx via SendARexxMsg() returns an error.
- X
- X
- X ReplyARexxMsg(rexx_handle,rmsg,result,error)
- X
- X This function replies the ARexx message gotten via
- X GetARexxMsg(). The "result" is a pointer to a result
- X string that is returned via OPTIONS RESULTS in the
- X RESULT ARexx variable. If you have no result, set this
- X to NULL. Error is the error severity level. If this
- X is 0, the result string will be returned, if this is
- X non-zero, the error level will be returned in RC.
- X
- X
- X worked=SendARexxMsg(rexx_handle,string,StringFileFlag)
- X
- X This function sends the string to ARexx. It sets the
- X default host to the context and sets the RXFB_STRING
- X bit in the message if the "StringFileFlag" is set.
- X This routine returns FALSE if the message was not sent
- X for some reason.
- X
- X
- X worked=SetARexxLastError(rexx_handle,rmsg,ErrorString)
- X
- X This function uses the RVI (Rexx Variable Interface) to
- X set a variable named <AppBaseName>.LASTERROR to the
- X ErrorString. This is where the "error" message should
- X go if there is an error. This function returns FALSE
- X if this fails for any reason.
- X
- X
- X FreeARexx(rexx_handle)
- X
- X This closes a SimpleRexx context. The rexx_handle is
- X one that was gotten from InitARexx(). The routine is
- X fully error checked so that you can pass it a NULL and
- X it will do nothing. This is useful if you want to
- X just blindly use the rexx_handle.
- END_OF_FILE
- if test 7339 -ne `wc -c <'SimpleRexx.doc'`; then
- echo shar: \"'SimpleRexx.doc'\" unpacked with wrong size!
- fi
- chmod +x 'SimpleRexx.doc'
- # end of 'SimpleRexx.doc'
- fi
- if test -f 'SimpleRexx.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'SimpleRexx.h'\"
- else
- echo shar: Extracting \"'SimpleRexx.h'\" \(3025 characters\)
- sed "s/^X//" >'SimpleRexx.h' <<'END_OF_FILE'
- X/*
- X * Simple ARexx interface by Michael Sinz
- X *
- X * This is a very "Simple" interface...
- X */
- X
- X#ifndef SIMPLE_REXX_H
- X#define SIMPLE_REXX_H
- X
- X#include <exec/types.h>
- X#include <exec/nodes.h>
- X#include <exec/lists.h>
- X#include <exec/ports.h>
- X
- X#include <rexx/storage.h>
- X#include <rexx/rxslib.h>
- X
- X/*
- X * This is the handle that SimpleRexx will give you
- X * when you initialize an ARexx port...
- X *
- X * The conditional below is used to skip this if we have
- X * defined it earlier...
- X */
- X#ifndef AREXXCONTEXT
- X
- Xtypedef void *AREXXCONTEXT;
- X
- X#endif /* AREXXCONTEXT */
- X
- X/*
- X * The value of RexxMsg (from GetARexxMsg) if there was an error returned
- X */
- X#define REXX_RETURN_ERROR ((struct RexxMsg *)-1L)
- X
- X/*
- X * This function closes down the ARexx context that was opened
- X * with InitARexx...
- X */
- Xvoid FreeARexx(AREXXCONTEXT);
- X
- X/*
- X * This routine initializes an ARexx port for your process
- X * This should only be done once per process. You must call it
- X * with a valid application name and you must use the handle it
- X * returns in all other calls...
- X *
- X * NOTE: The AppName should not have spaces in it...
- X * Example AppNames: "MyWord" or "FastCalc" etc...
- X * The name *MUST* be less that 16 characters...
- X * If it is not, it will be trimmed...
- X * The name will also be UPPER-CASED...
- X *
- X * NOTE: The Default file name extension, if NULL will be
- X * "rexx" (the "." is automatic)
- X */
- XAREXXCONTEXT InitARexx(char *,char *);
- X
- X/*
- X * This function returns the port name of your ARexx port.
- X * It will return NULL if there is no ARexx port...
- X *
- X * This string is *READ ONLY* You *MUST NOT* modify it...
- X */
- Xchar *ARexxName(AREXXCONTEXT);
- X
- X/*
- X * This function returns the signal mask that the Rexx port is
- X * using. It returns NULL if there is no signal...
- X *
- X * Use this signal bit in your Wait() loop...
- X */
- XULONG ARexxSignal(AREXXCONTEXT);
- X
- X/*
- X * This function returns a structure that contains the commands sent from
- X * ARexx... You will need to parse it and return the structure back
- X * so that the memory can be freed...
- X *
- X * This returns NULL if there was no message...
- X */
- Xstruct RexxMsg *GetARexxMsg(AREXXCONTEXT);
- X
- X/*
- X * Use this to return a ARexx message...
- X *
- X * If you wish to return something, it must be in the RString.
- X * If you wish to return an Error, it must be in the Error.
- X */
- Xvoid ReplyARexxMsg(AREXXCONTEXT,struct RexxMsg *,char *,LONG);
- X
- X/*
- X * This function will send a string to ARexx...
- X *
- X * The default host port will be that of your task...
- X *
- X * If you set StringFile to TRUE, it will set that bit for the message...
- X *
- X * Returns TRUE if it send the message, FALSE if it did not...
- X */
- Xshort SendARexxMsg(AREXXCONTEXT,char *,short);
- X
- X/*
- X * This function will set an error string for the ARexx
- X * application in the variable defined as <appname>.LASTERROR
- X *
- X * Note that this can only happen if there is an ARexx message...
- X *
- X * This returns TRUE if it worked, FALSE if it did not...
- X */
- Xshort SetARexxLastError(AREXXCONTEXT,struct RexxMsg *,char *);
- X
- X#endif /* SIMPLE_REXX_H */
- END_OF_FILE
- if test 3025 -ne `wc -c <'SimpleRexx.h'`; then
- echo shar: \"'SimpleRexx.h'\" unpacked with wrong size!
- fi
- # end of 'SimpleRexx.h'
- fi
- if test -f 'SimpleRexxE.uu' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'SimpleRexxE.uu'\"
- else
- echo shar: Extracting \"'SimpleRexxE.uu'\" \(11680 characters\)
- sed "s/^X//" >'SimpleRexxE.uu' <<'END_OF_FILE'
- Xbegin 666 SimpleRexxExample
- XM```#\P`````````"``````````$```>*````]@```^D```>*2.=^_B1()`!)!
- XM^0`````L>``$1_D```'`<@`@/````(9@`B;!4<C__"E/`@`I3@'X0JP!_'``8
- XM(CP``#``3J[^SD/Z`5IP`$ZN_=@I0`,(9@9P9&```/PF;@$4*6L`F`'T2JL`^
- XMK&=H(`^0KP`X!H````"`*4`!Q"!K`*S1R-'((F@`$-/)T\D@`G(`$ADI20((+
- XMT(%2@$)G4H`"0/_^G\!5@$)W"``@`E.`U($?L@``(`!3@E'(__8?O``@(`!3>
- XM@A^Q(``@`%'*__@B3R\)8'(I:P`Z`<1P?U*`T:P!Q$'K`%Q.KOZ`0>L`7$ZN[
- XM_HPI0`'\+P`D0"`J`"1G$BQL`P@@0"(H```I00'T3J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],P$YU?
- XM```O!RX`<``Y0`'82D=K)+YL`%!L'B`'<@;!P4'L`@Q*<`@`9PX@!\'!0>P"U
- XM#-'`(`A@"#E\``D#!'``+A].=0``````````````````8```1DYQ```@;P`$J
- XM8``%`DYQ```P,3(S-#4V-S@Y86)C9&5F44\B3S(``D$`#Q+[$.3HB&;R(`DBQ
- XM#Q#ALHEF^D(0D(%03TYU2.<`,B9L`PP@"V<4)%,B2R`K``@L>``$3J[_+B9*`
- XM8.B1R"E(`Q`I2`,,3-],`$YU2.<!,BX`<`S>@"`'<@`L>``$3J[_.B9`(`MFV
- XM!'``8#HG1P`(1>P##"!J``0G2``$D<@FB$J29@(DBTJJ``1G!B)J``0BBR5+1
- XM``1*K`!49@0I2P!40>L`#"`(3-],@$YU````````````````2.<',"X`)D@L(
- XM`2`'3KK^PB1`(`IF!'#_8#`(*@`#``%G#G`"/P`@!W(`3KKZ3%1/("H``B(&!
- XM($M.NONN*@!*;`'89P1P_V`"(`5,WPS@3G5.5?_02.<G,"9()$E^`'P`>@!P'
- XM`!M\`"#_^W(`.T'_^#M\____]D'M_]@;0/_U&T#__#M!_^P[0?_N*TC_U$H3=
- XM9RQP`!`3!$``(&<45T!G%%%`9PA50&86?@%@#GP!8`IZ`6`&&WP``?_\4HM@M
- XMT!`3<C"P`68&4HL;0?_[<"JP$V8,(%)4DCM0__A2BV`,($M#[?_X3KKXUM;`5
- XM$!-R+K`!9B!2BW`JL!-F#"!25)([4/_V4HM@#"!+0^W_]DZZ^*[6P!`3<FRP,
- XM`68*&WP``?_U4HM@"')HL`%F`E*+$!MR`!(`&T#_]`1!`%AG``%T!$$`"V<`_
- XM`?Q306<D!$$`"V<``0I306<``49706<``:Q506<``-I706<``4A@``'J2BW_L
- XM]6<((%)8DB`08`@@4E22,!!(P"M`__!L"G(!1*W_\#M!_^Y*;?_N9P1P+6`*:
- XM2@9G!'`K8`)P(!M`_]AP`!`&,BW_[H)`<``0!8)`9PA2K?_44FW_["`M__`@<
- XM;?_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P_V`XWZL`!$J39PZSTV8*("D`!-&K``0FE
- XMD7``8!XK2__T*VW_[/_H)E-@`/]N(&W_]""*0I(E1P`$<`!,WTR`3EU.=4CG*
- XM!S`N`"9(+`$@!TZZ]M(D0"`*9@1P_V`:("H``B(&($M.NO2D*@!*;`'89P1PK
- XM_V`"(`5,WPS@3G4``$I`;QBSR&4.T,#2P%-`$R!1R/_\3G42V%'(__Q.=0``?
- XM(&\`!$CG("(D2"QY````!$/Z`@9P`$ZN_=@D`&<<(D!.KOYB<`"TJ@`89@XB`
- XM*@`49P@@2BQ"3J[_6$J`3-]$!$YU3.\#```$80IF!B!O``P@B4YU2.<P/B1(!
- XM)DEAIF<P+&H`&"!J`!1.KO^4*$@@2V$``+AF'"1))`$@3"`"<@!.KO^X<`!0C
- XMB4J!9P:3R6`"<`I*@$S??`Q.=4SO`P``!$SO``,`#$CG/SY/[__T)$@F22I`G
- XM)@%!^@!8(D]A``$D($IA`/]`9TPL:@`8<`D,@P``__]N0"!J`!1.KO^4*$@@-
- XM2V$``$9F+B1))`$@3"`"3J[_OB@`($PB32`#80``EF<.($PB0"`$3J[_K'``Z
- XM8`9P`V`"<`H@3R\`80``YB`?3^\`#$S??/Q.=4CG,#!T`'8`3J[^X")(($QA3
- XM6"1`9S9#Z@`(,"H`!"()#!D`+E?(__IF$,.)DHDF"B!,(`%A-"1`9Q)!Z@`(!
- XM3J[_FK)J``1G!G0H8`)T`TJ"9PP@3")*848@3")#84`B2B(#(`),WPP,3G5((
- XMYX!`4(!2@$ZN_XY,WP(!9QXO"$*0,4``!!%\``(`!D(P"`A0B$ZN_O(@7Q%`N
- XM``<@"$YU(@EG%'`!P"D`!F8,,"D`!%"`4H!.KO^(3G4O"R9J`!0C2@``3.L`Q
- XM`P#\2.L#``#\2.D``P`$)E].=2)H```B:0`43.@``P`$2.D``P#\3G5R97AX/
- XM<WES;&EB+FQI8G)A<GD``````^P````"`````0```!0````*`````````_(`^
- XM``/J````<```!?@```80```&*@``!C@```9>```&=```!HH```:D`&$`+P$KR
- XM`"S__P```@```@!/```````````````````````````!(@`H_____P`!`"@`M
- XM````````````````````````````````@````````````````````````````
- XM````F```````````````````````````````````````````````````````8
- XM````@`````0`````("`@("`@("`@*"@H*"@@("`@("`@("`@("`@("`@("!(T
- XM$!`0$!`0$!`0$!`0$!`0A(2$A(2$A(2$A!`0$!`0$!"!@8&!@8$!`0$!`0$!5
- XM`0$!`0$!`0$!`0$!`1`0$!`0$(*"@H*"@@("`@("`@("`@("`@("`@("`@("A
- XM$!`0$"`@("`@("`@("`H*"@H*"`@("`@("`@("`@("`@("`@($@0$!`0$!`0`
- XM$!`0$!`0$!"$A(2$A(2$A(2$$!`0$!`0$(&!@8&!@0$!`0$!`0$!`0$!`0$!L
- XM`0$!`0$!$!`0$!`0@H*"@H*"`@("`@("`@("`@("`@("`@("`@(0$!`0(```Z
- XM``(```````/L````"``````````<````&````!0````0````#`````@````$I
- X<``````````(````!````@````&@````````#\A0`T
- X``
- Xend
- Xsize 8308
- END_OF_FILE
- if test 11680 -ne `wc -c <'SimpleRexxE.uu'`; then
- echo shar: \"'SimpleRexxE.uu'\" unpacked with wrong size!
- fi
- # end of 'SimpleRexxE.uu'
- fi
- if test -f 'SimpleRexxExample.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'SimpleRexxExample.c'\"
- else
- echo shar: Extracting \"'SimpleRexxExample.c'\" \(4815 characters\)
- sed "s/^X//" >'SimpleRexxExample.c' <<'END_OF_FILE'
- X/*
- X * This is an example of how to use the SimpleRexx code.
- X */
- X
- X#include <exec/types.h>
- X#include <libraries/dos.h>
- X#include <libraries/dosextens.h>
- X#include <intuition/intuition.h>
- X
- X#include <proto/exec.h>
- X#include <proto/intuition.h>
- X
- X#include <rexx/storage.h>
- X#include <rexx/rxslib.h>
- X
- X#include <stdio.h>
- X#include <string.h>
- X
- X#include "SimpleRexx.h"
- X
- X/*
- X * Lattice control-c stop...
- X */
- Xint CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */
- Xint chkabort(void) { return(0); } /* really */
- X
- X/*
- X * The strings in this program
- X */
- Xchar *strings[]=
- X{
- X "50: Window already open", /* STR_ID_WINDOW_OPEN */
- X "101: Window did not open", /* STR_ID_WINDOW_ERROR */
- X "50: No Window", /* STR_ID_WINDOW_NONE */
- X "80: Argument error to WINDOW command", /* STR_ID_WINDOW_ARG */
- X "100: Unknown command", /* STR_ID_COMMAND_ERROR */
- X "ARexx port name: %s\n", /* STR_ID_PORT_NAME */
- X "No ARexx on this system.\n", /* STR_ID_NO_AREXX */
- X "SimpleRexxExample Window" /* STR_ID_WINDOW_TITLE */
- X};
- X
- X#define STR_ID_WINDOW_OPEN 0
- X#define STR_ID_WINDOW_ERROR 1
- X#define STR_ID_WINDOW_NONE 2
- X#define STR_ID_WINDOW_ARG 3
- X#define STR_ID_COMMAND_ERROR 4
- X#define STR_ID_PORT_NAME 5
- X#define STR_ID_NO_AREXX 6
- X#define STR_ID_WINDOW_TITLE 7
- X
- X/*
- X * NewWindow structure...
- X */
- Xstatic struct NewWindow nw=
- X{
- X 97,47,299,44,-1,-1,
- X CLOSEWINDOW,
- X WINDOWSIZING|WINDOWDRAG|WINDOWDEPTH|WINDOWCLOSE|SIMPLE_REFRESH|NOCAREREFRESH,
- X NULL,NULL,
- X NULL,
- X NULL,NULL,290,40,-1,-1,WBENCHSCREEN
- X};
- X
- X/*
- X * A *VERY* simple and simple-minded example of using the SimpleRexx.c code.
- X *
- X * This program, when run, will print out the name of the ARexx port it
- X * opens. Use that port to tell it to SHOW the window. You can also
- X * use the ARexx port to HIDE the window, to READTITLE the window's
- X * titlebar, and QUIT the program. You can also quit the program by
- X * pressing the close gadget in the window while the window is up.
- X *
- X * Note: You will want to RUN this program or have another shell available such
- X * that you can still have access to ARexx...
- X */
- Xvoid main(int argc,char *argv[])
- X{
- Xshort loopflag=TRUE;
- XAREXXCONTEXT RexxStuff;
- Xstruct Window *win=NULL;
- XULONG signals;
- X
- X if (IntuitionBase=(struct IntuitionBase *)
- X OpenLibrary("intuition.library",NULL))
- X {
- X /*
- X * Note that SimpleRexx is set up such that you do not
- X * need to check for an error to initialize your REXX port
- X * This is so your application could run without REXX...
- X */
- X RexxStuff=InitARexx("Example","test");
- X
- X if (argc)
- X {
- X if (RexxStuff) printf(strings[STR_ID_PORT_NAME],
- X ARexxName(RexxStuff));
- X else printf(strings[STR_ID_NO_AREXX]);
- X }
- X
- X while (loopflag)
- X {
- X signals=ARexxSignal(RexxStuff);
- X if (win) signals|=(1L << (win->UserPort->mp_SigBit));
- X
- X if (signals)
- X {
- X struct RexxMsg *rmsg;
- X struct IntuiMessage *msg;
- X
- X signals=Wait(signals);
- X
- X /*
- X * Process the ARexx messages...
- X */
- X while (rmsg=GetARexxMsg(RexxStuff))
- X {
- X char cBuf[24];
- X char *nextchar;
- X char *error=NULL;
- X char *result=NULL;
- X long errlevel=0;
- X
- X nextchar=stptok(ARG0(rmsg),
- X cBuf,24," ,");
- X if (*nextchar) nextchar++;
- X
- X if (!stricmp("WINDOW",cBuf))
- X {
- X if (!stricmp("OPEN",nextchar))
- X {
- X if (win)
- X {
- X error=strings[STR_ID_WINDOW_OPEN];
- X errlevel=5;
- X }
- X else
- X {
- X nw.Title=strings[STR_ID_WINDOW_TITLE];
- X if (!(win=OpenWindow(&nw)))
- X {
- X error=strings[STR_ID_WINDOW_ERROR];
- X errlevel=30;
- X }
- X }
- X }
- X else if (!stricmp("CLOSE",nextchar))
- X {
- X if (win)
- X {
- X CloseWindow(win);
- X win=NULL;
- X }
- X else
- X {
- X error=strings[STR_ID_WINDOW_NONE];
- X errlevel=5;
- X }
- X }
- X else
- X {
- X error=strings[STR_ID_WINDOW_ARG];
- X errlevel=20;
- X }
- X }
- X else if (!stricmp("READTITLE",cBuf))
- X {
- X if (win)
- X {
- X result=win->Title;
- X }
- X else
- X {
- X error=strings[STR_ID_WINDOW_NONE];
- X errlevel=5;
- X }
- X }
- X else if (!stricmp("QUIT",cBuf))
- X {
- X loopflag=FALSE;
- X }
- X else
- X {
- X error=strings[STR_ID_COMMAND_ERROR];
- X errlevel=20;
- X }
- X
- X if (error)
- X {
- X SetARexxLastError(RexxStuff,rmsg,error);
- X }
- X ReplyARexxMsg(RexxStuff,rmsg,result,errlevel);
- X }
- X
- X /*
- X * If we have a window, process those messages
- X */
- X if (win) while (msg=(struct IntuiMessage *)
- X GetMsg(win->UserPort))
- X {
- X if (msg->Class==CLOSEWINDOW)
- X {
- X /*
- X * Quit if the close gadget...
- X */
- X loopflag=FALSE;
- X }
- X ReplyMsg((struct Message *)msg);
- X }
- X }
- X else loopflag=FALSE;
- X }
- X if (win) CloseWindow(win);
- X
- X FreeARexx(RexxStuff);
- X CloseLibrary((struct Library *)IntuitionBase);
- X }
- X}
- END_OF_FILE
- if test 4815 -ne `wc -c <'SimpleRexxExample.c'`; then
- echo shar: \"'SimpleRexxExample.c'\" unpacked with wrong size!
- fi
- # end of 'SimpleRexxExample.c'
- fi
- if test -f 'test.results' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'test.results'\"
- else
- echo shar: Extracting \"'test.results'\" \(241 characters\)
- sed "s/^X//" >'test.results' <<'END_OF_FILE'
- XError was 50: No Window
- XError was 80: Argument error to WINDOW command
- XWindow is now open
- XError was 50: Window already open
- XWindow title is SimpleRexxExample Window
- XWindow is now closed
- XError was 50: No Window
- XError was 100: Unknown command
- END_OF_FILE
- if test 241 -ne `wc -c <'test.results'`; then
- echo shar: \"'test.results'\" unpacked with wrong size!
- fi
- # end of 'test.results'
- fi
- if test -f 'test.rexx' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'test.rexx'\"
- else
- echo shar: Extracting \"'test.rexx'\" \(1360 characters\)
- sed "s/^X//" >'test.rexx' <<'END_OF_FILE'
- X/*
- X * SimpleRexx test...
- X *
- X * You need to run the SimpleRexxExample first...
- X */
- X
- XOptions FailAt 100
- X
- XOptions Results
- X
- X/*
- X * Try to read the window title bar
- X */
- XAddress EXAMPLE_1 ReadTitle
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window title is 'Result
- X
- X/*
- X * Bad WINDOW command...
- X */
- XAddress EXAMPLE_1 "Window Display"
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window is now open'
- X
- X/*
- X * Open the window
- X */
- XAddress EXAMPLE_1 "Window Open"
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window is now open'
- X
- X/*
- X * Open the window
- X */
- XAddress EXAMPLE_1 "Window Open"
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window is now open'
- X
- X/*
- X * Try to read the window title bar
- X */
- XAddress EXAMPLE_1 ReadTitle
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window title is 'Result
- X
- X/*
- X * Hide the window
- X */
- XAddress EXAMPLE_1 "Window Close"
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window is now closed'
- X
- X/*
- X * Try to hide the window again
- X */
- XAddress EXAMPLE_1 "Window Close"
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'Window is now closed'
- X
- X/*
- X * Send a command that does not exist
- X */
- XAddress EXAMPLE_1 Junk
- X
- Xif rc > 0 then say 'Error was 'EXAMPLE.LASTERROR
- Xelse say 'The command worked!!!'
- X
- X/*
- X * Quit the program...
- X */
- XAddress EXAMPLE_1 Quit
- END_OF_FILE
- if test 1360 -ne `wc -c <'test.rexx'`; then
- echo shar: \"'test.rexx'\" unpacked with wrong size!
- fi
- # end of 'test.rexx'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
- Mail comments to the moderator at <amiga-request@uunet.uu.net>.
- Post requests for sources, and general discussion to comp.sys.amiga.misc.
-